# coding: UTF-8

#
# This file is a part of the open-eBackup project.
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
# If a copy of the MPL was not distributed with this file, You can obtain one at
# http://mozilla.org/MPL/2.0/.
#
# Copyright (c) [2024] Huawei Technologies Co.,Ltd.
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
#

from pydantic import BaseModel, Field
from redis.common.const import SubJobType, ExecutePolicy


class SubJob(BaseModel):
    job_id: str = Field(default='', description='任务ID', alias='jobId')
    sub_job_id: str = Field(default='', description='子任务ID', alias='subJobId')
    job_type: str = Field(default=SubJobType.BUSINESS_SUB_JOB, description='任务类型', alias='jobType')
    job_name: str = Field(default='', description='任务名', alias='jobName')
    job_priority: int = Field(default=1, description='任务优先级', alias='jobPriority')
    policy: int = Field(default=ExecutePolicy.FIXED_NODE, description='策略')
    ignore_failed: bool = Field(default=False, description='是否忽略失败结果', alias='ignoreFailed')
    exec_node_id: str = Field(default='', description='执行任务节点ID', alias='execNodeId')
    job_info: str = Field(default='', description='任务信息', alias='jobInfo')
